syncer.js ➔ syncerChooser   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 4
nop 4
dl 0
loc 13
ccs 5
cts 5
cp 1
cc 3
crap 3
rs 9.4285
1
import CollectionSyncer from './syncers/collection'
2
import ItemSyncer from './syncers/item'
3
4
/**
5
 * Chooses and returns the preferred syncer
6
 *
7
 * @param Vue
8
 * @param vm
9
 * @param path
10
 * @param settings
11
 * @returns {BaseFeathersSyncer}
12
 */
13
export default function syncerChooser(Vue, vm, path, settings) {
14 10
	if (typeof settings === 'string') {
15 4
		settings = {
16
			service: settings
17
		}
18
	}
19
20
	// Choose syncer to use
21 10
	if ('id' in settings) {
22 5
		return new ItemSyncer(Vue, vm, path, settings)
23
	}
24 5
	return new CollectionSyncer(Vue, vm, path, settings)
25
}
26